/* 主要内容区样式 */
.main-wrapper {
  flex: 1;
  display: flex;
  width: 100%;
  /* height: 100vh; */ /* 移除或注释掉 */
  background-color: #f8f9fa; /* 统一浅灰背景 */
  position: relative;
}

.main-content {
  width: 100%;
  display: flex;
  flex-direction: column;
  min-height: 100vh; /* 确保聊天页面至少占满屏幕 */
  position: relative;
  background-color: #f8f9fa; /* 统一浅灰背景 */
}

.chat-container {
  width: 100%;
  padding: 2rem;
  display: flex;
  flex-direction: column;
  gap: 2rem;
  background-color: #f8f9fa; /* 统一浅灰背景 */
  padding-bottom: 140px; /* 增加底部距离 */
  flex-grow: 1; /* 让 chat-container 填充 main-content */
}

/* 聊天容器样式 */
.chat-container {
  width: 100%;
  padding: 2rem;
  display: flex;
  flex-direction: column;
  gap: 2rem;
  background-color: #f8f9fa; /* 统一浅灰背景 */
  padding-bottom: 140px; /* 增加底部距离 */
}
.chat-main {
  width: 90%; /* 稍微加宽 */
  margin: 0 auto; 
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 2rem;
  padding: 0 1rem;
  max-width: 900px; /* 限制最大宽度 */
}
.message {
  display: flex;
  animation: fadeIn 0.3s ease-in-out;
  width: 100%;
  padding: 0.5rem 0;
}

.message-wrapper {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.message-content-with-avatar {
  display: flex;
  gap: 1rem;
  align-items: flex-start;
}

.avatar {
  width: 40px;
  height: 40px;
  border-radius: 12px; /* 统一圆角 */
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.4rem;
  background-color: #e9ecef; /* 浅灰色背景 */
  flex-shrink: 0;
}

.content-wrapper {
  flex: 1;
  max-width: 95%;
}

/* 用户消息样式 */
.user-message {
  background-color: #007aff; /* 主题蓝 */
  color: white;
  padding: 0.9rem 1.4rem; /* 调整内边距 */
  border-radius: 18px 18px 4px 18px; /* 调整圆角 */
  margin-left: auto;
  max-width: 85%; /* 调整最大宽度 */
  box-shadow: 0 4px 12px rgba(0, 122, 255, 0.15);
}

/* AI消息样式 */
.message-content {
  background-color: #ffffff; /* 白色背景 */
  padding: 0.9rem 1.4rem; /* 调整内边距 */
  border-radius: 18px 18px 18px 4px; /* 调整圆角 */
  color: #1a1a1a; /* 深色文字 */
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
}

/* 思维链样式 */
.reasoning-content {
  background-color: #f0f4f8; /* 更柔和的背景 */
  border-radius: 12px;
  margin-bottom: 1rem;
  overflow: hidden;
  border: 1px solid #e2eafc; /* 添加边框 */
}

.reasoning-header {
  padding: 0.75rem 1.25rem;
  font-size: 0.9rem;
  color: #555; /* 中灰色 */
  background-color: #e9eff8; /* 头部背景 */
  display: flex;
  align-items: center;
  gap: 0.5rem;
  border-bottom: 1px solid #d6e0f0; /* 调整边框 */
}

.reasoning-body {
  padding: 1.25rem;
  color: #444; /* 稍深一点的文字 */
  font-size: 0.95rem;
  line-height: 1.6;
}

/* 输入区域样式 */
.input-area {
  padding: 0.5rem; /* 增加内边距 */
  background-color: #ffffff; /* 白色背景 */
  border: none; /* 移除边框 */
  border-radius: 28px; /* 增大圆角 */
  position: sticky; /* 改为 sticky 定位 */
  bottom: 1.5rem; /* 增加底部距离 */
  width: calc(85% - 3rem); /* 调整宽度 */
  max-width: 850px; /* 限制最大宽度 */
  margin: 1rem auto; /* 保持居中 */
  z-index: 10; /* 确保在内容之上 */
  min-height: 56px; /* 调整最小高度 */
  display: flex;
  align-items: center;
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.08); /* 调整阴影 */
  overflow: visible; /* 允许阴影显示 */
}

.input-container {
  flex: 1; /* 让输入框填满整个区域 */
  background-color: transparent; /* 背景透明，与父级一致 */
  display: flex;
  gap: 0.5rem;
  align-items: center;
  padding: 0.5rem 0.8rem 0.5rem 1.5rem; /* 调整内边距 */
  border: none; /* 移除边框 */
  box-shadow: none; /* 移除阴影 */
}
.input-container :deep(.el-textarea__inner) {
  border: none !important;
  background: transparent !important;
  box-shadow: none !important;
  outline: none !important;
  resize: none !important;
  padding: 0.6rem 0 !important; /* 调整内边距 */
  min-height: 24px !important; /* 调整最小高度 */
  line-height: 1.6;
  font-size: 1rem;
  color: #1a1a1a;
}
.input-container :deep(.el-textarea__inner:focus) {
  flex: 1;
  border: none!important;
  outline: none;
  background: transparent;
  padding: 0.8rem 1.2rem;
  min-height: 44px !important;
  font-size: 1rem;
  line-height: 1.5;
  resize: none;
  box-shadow: none !important;
}
.input-container :deep(.el-textarea__inner::placeholder) {
  color: #999;
}
.chat-input:deep(.el-textarea__inner){
  border: none !important;
  background: transparent !important;
  box-shadow: none !important;
  outline: none !important;
  resize: none !important;
}
.send-button {
  height: 44px; /* 调整高度 */
  min-width: 44px; /* 确保圆形 */
  padding: 0; /* 移除内边距 */
  width: 44px; /* 固定宽度 */
  border-radius: 50%; /* 圆形按钮 */
  font-size: 1.2rem; /* 图标大小 */
  background-color: #007aff; /* 主题蓝 */
  border-color: #007aff;
  color: #ffffff;
  transition: all 0.3s ease;
  display: flex; /* 居中图标 */
  align-items: center;
  justify-content: center;
  margin-right: 4px; /* 按钮与边框的距离 */
}
.send-button:hover {
  background-color: #0056b3;
  border-color: #0056b3;
  transform: scale(1.05); /* 悬浮放大 */
}
.send-button .el-icon {
  font-size: 1.3rem;
}
.el-textarea__inner{
  border: none !important;
  background: transparent !important;
  box-shadow: none !important;
  outline: none !important;
  resize: none !important;
}

/* 历史对话列表样式 */
.conversations-list {
  flex: 1;
  overflow-y: auto;
  margin: 1rem 0;
  padding-right: 0.5rem;
}

.conversations-list h3 {
  font-size: 0.9rem;
  color: #666;
  margin: 0.5rem 0;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid #eee;
}

.conversation-item {
  padding: 0.8rem 1rem; /* 调整内边距 */
  border-radius: 10px; /* 调整圆角 */
  margin-bottom: 0.5rem;
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: center;
  transition: background-color 0.2s;
}

.conversation-item:hover {
  background-color: #eef2f7; /* 调整悬浮背景色 */
}

.conversation-item.active {
  background-color: #e0eafc; /* 调整激活背景色 */
  border-left: 3px solid #007aff; /* 主题色边框 */
  font-weight: 500; /* 激活时加粗 */
}

.conversation-title {
  font-size: 0.9rem;
  color: #333;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  flex: 1;
}

.conversation-actions {
  display: flex;
  align-items: center;
  visibility: hidden;
}

.conversation-item:hover .conversation-actions {
  visibility: visible;
}

.delete-btn {
  background: none;
  border: none;
  color: #999;
  cursor: pointer;
  padding: 0.2rem;
  border-radius: 4px;
  font-size: 1rem;
  display: flex;
  align-items: center;
  justify-content: center;
}

.delete-btn:hover {
  color: #ff4d4f; /* 调整删除按钮颜色 */
  background-color: rgba(255, 77, 79, 0.1);
}

.no-conversations {
  color: #999;
  text-align: center;
  padding: 1rem 0;
  font-size: 0.9rem;
}

.loading-spinner {
  text-align: center;
  padding: 1rem;
  color: #666;
}

/* 移动端样式 */
@media (max-width: 768px) {
  .sidebar {
    position: fixed;
    left: -260px;
    top: 0;
    bottom: 0;
    z-index: 1000;
    transition: left 0.3s ease-in-out;
  }

  .sidebar.mobile-open {
    left: 0;
  }

  .main-content {
    margin: 0;
  }

  .chat-container {
    padding: 1rem;
  }

  .input-area {
    padding: 0.5rem;
  }

  .user-message, 
  .message-content {
    max-width: 90%;
  }

  .input-container {
    border-radius: 8px;
  }
}

/* 隐藏移动端菜单按钮在桌面端 */
.mobile-menu-btn {
  display: none;
}

/* 动画效果 */
@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* 加载动画 */
.loading {
  display: flex;
  gap: 0.5rem;
  padding: 1rem;
  justify-content: center;
}

.loading span {
  width: 8px;
  height: 8px;
  background-color: #2563eb;
  border-radius: 50%;
  animation: bounce 1s infinite;
  opacity: 0.6;
}

@keyframes bounce {
  0%, 100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-5px);
  }
}

/* 滚动条样式 */
::-webkit-scrollbar {
  width: 5px; /* 稍微变细 */
  overflow-y: scroll;
  overflow-x: hidden;
  position: relative;
}

::-webkit-scrollbar-track {
  background: transparent; /* 轨道透明 */
}

::-webkit-scrollbar-thumb {
  background: #dce1e6; /* 更浅的滑块颜色 */
  border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
  background: #c8ced3;
}
/* 添加固定高度布局相关的样式 */
.chat-container-wrapper {
  flex: 1;
  display: flex;
  flex-direction: column;
  position: relative;
  overflow-y: auto;
  min-height: calc(100vh - 120px); /* 减去页眉和输入区域的高度 */
}

.chat-container {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  overflow-y: auto;
  padding-bottom: 120px; /* 确保内容不被输入框遮挡 */
}
.main-content{
  width: 100%;
}


@media (max-width: 768px) {
  .chat-container-wrapper {
    min-height: calc(100vh - 100px);
  }
  
  .input-area {
    width: 90%;
    bottom: 15px;
  }
}